﻿using ProjectCloth.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AutoExportFormCode
{
    class Program
    {
        static void Main(string[] args)
        {
            var product = new Product();
            CreateForm(product.GetType(), "编辑商品", "ProjectCloth.FrmUI");
        }
        static void CreateForm(Type type, string name, string namesp)
        {
            var formName = type.Name;
            var formText = name;
            foreach (var proporty in type.GetProperties())
            {

            }
            System.IO.File.WriteAllText("D://" + formName + "Form.cs", CodeDemo(namesp, name ,namesp));

        }
        static string CodeDemo(string np, string name, string pf)
        {
            var model = @"namespace "+ np+@"
{
    partial class ProductFrm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param >true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {"+@"
           
        }

        #endregion
"+@"
       //
    }
}";

            return model;
        }
    }
}
